{extend name='table'}

{block name="button"}


<!--{if auth("add")}-->
<button data-modal='{:url("add")}' data-title="{:lang('添加平台')}" class='layui-btn layui-btn-sm layui-btn-primary'>{:lang('添加平台')}</button>
<!--{/if}-->


{/block}

{block name="content"}
<div class="layui-tab layui-tab-card">

    <div class="layui-tab-content">
        {include file='account/index/index_search'}
        <table id="TableList" data-url="{:sysuri('index')}" data-target-search="form.form-search"></table>
    </div>
</div>
<script>

    var maxWidth = window.innerWidth;
    var maxHeight = window.innerHeight;

    $(function () {
        $('#TableList').layTable({
            even: true, height: 'full',
            sort: {field: 'sort asc,id', type: 'desc'},
            where: {type: '{$type|default="index"}'},
            cols: [[
                {field: 'LAY_NUM', title: '{:lang("序号")}', width: 100, align: 'center', },
                {
                    field: 'logo', title: '{:lang("封面图")}', minWidth: 100, align: 'center', templet: function (d) {
                        if (!d.logo) return '-';
                        return layui.laytpl('<div class="headimg headimg-ss shadow-inset margin-0" data-tips-image data-tips-hover data-lazy-src="{{d.logo}}"></div>').render(d);
                    }
                },
                {field: 'title', title: '{:lang("平台名字")}', minWidth: 100, align: 'center', },
                {field: 'is_set', title: '{:lang("是否配置")}', align: 'center', minWidth: 110, templet: '#StatusTpl'},

                {field: 'create_at', title: '{:lang("创建时间")}', minWidth: 100, align: 'center' },
                {toolbar: '#toolbar', title: '{:lang("操作面板")}', align: 'center', minWidth: 180, fixed: 'right'}
            ]]
        });

    });
</script>

<!-- 数据状态切换模板 -->
<script type="text/html" id="StatusTpl">
    <!--{if auth("state")}-->

    {{-d.is_set ? '<b class="color-green">{:lang("已设置")}</b>' : '<b class="color-red">{:lang("未设置")}</b>'}}
    <!--{/if}-->
</script>

<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTpl">
    <input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>

<script type="text/html" id="toolbar">


    <!--{if auth("edit")}-->
    <a class="layui-btn layui-btn-sm" data-event-dbclick data-title="{:lang('配置')}" data-modal='{:url("config")}?id={{d.id}}'>{:lang('配 置')}</a>
    <!--{/if}-->


</script>
{/block}
